home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
L' Effet Pommier 3
/
L'Effet Pommier - Volume 03.iso
/
Programmation
/
Alpha ƒ
/
Tcl
/
SystemCode
/
menus.tcl
< prev
next >
Wrap
Text File
|
1996-01-23
|
9KB
|
474 lines
# My menus.
menu -n File -p fileMenuProc {
"/Nnew"
"/Oopen╔"
{menu -n recent {}}
"<S/Wclose"
"<S<I<O/WcloseAll"
"(-"
"<S/Ssave"
"<S<I<O/SsaveAll"
"<SsaveACopyAs╔"
"<SsaveAs╔"
"<E<SrevertToBackup"
"<Srevert"
"(-"
"<S/Y<Oshell"
"<S/Y<B<OtoolserverShell"
"(-"
"pageSetup╔"
{menu -n print {}}
"(-"
"/Qquit"
}
proc fileMenuProc {menu item} {
if {$item == "open"} {
findFile
} elseif {$item == "close"} {
killWindow
} else {
$item
}
}
menu -n Edit {
"/Zundo"
"/Z<I<Oredo"
"/Lload"
"(-"
"/X<Scut"
"/X<S<I<Ocut&Append"
"/C<Scopy"
"/C<S<I<Ocopy&Append"
"/V<Spaste"
"/V<S<I<OpastePop"
"/A<SselectAll"
"/A<S<I<OselectParagraph"
"clear"
"(-"
{menu -n emacs {}}
"/`<Stwiddle"
"/`<S<I<OtwiddleWords"
"(-"
{/[<SshiftLeft}
{/[<S<I<OshiftLeftSpace}
{/]<SshiftRight}
{/]<S<I<OshiftRightSpace}
"/Bbalance"
}
menu -n Search {
"/F<Sfind╔"
"/F<S<I<OsearchStart"
"/G<SfindAgain"
"/G<S<I<OfindAgainBackward"
"/MfindInNextFile"
"/E<SenterSearchString"
"/E<S<I<OenterReplaceString"
"(-"
"/S<BquickFind"
"/R<BreverseQuickFind"
"(-"
"/Rreplace"
"/Hreplace&FindAgain"
"<S/R<O<IreplaceAll"
"<S/R<O<I<BreplaceInFileset"
"(-"
"/,<BpushPosition"
"/.<BpopPosition"
"/G<IgotoLine"
}
proc pushPosition {} {pushMark}
proc popPosition {} {popMark}
# {menu -n NamedClipboards -p namedClipMenuProc {"copy╔" "cut╔" "paste╔"}}
# {menu -n registers { pointToRegister jumpToRegister }}
proc namedMarkProc {menu item} {
switch $item {
"markFile" {markFile; message "File marked."}
"set" {setNamedMark}
"goto" {gotoFileMark}
"remove" {removeNamedMark}
"sort" {sortMarksFile}
"sortByPosition" {orderMarks}
}
}
proc unnamedMarkproc {menu item} {
switch $item {
"set" {setMark}
"exchangePointAndMark" {exchangePointAndMark}
"hilite" {markHilite}
}
}
proc installProc {menu item} {
switch $item {
"Electric Alias" {loadElectricAlias}
"LaTeX 2.09" {loadLaTeX}
"LaTeX2e" {loadLaTeX}
"MacPerl" {loadMacPerl}
}
}
menu -n "Utils" {
{menu -n fileUtils {
"insertPathName╔"
"insertFile╔"
"fileRemove╔"
"fileInfo╔"
"wordCount"
"textToAlpha"}}
{menu -m -n compare -p compareProc {
"Windows"
"Files╔"
"Directories╔"}}
{menu -n asciiEtc {
"quoteChar"
"(-"
"keyCode"
"keyAscii"
"getAscii"
"insertAscii"}}
{menu -n KbdMacros {
"/qstartKeyboardMacro"
"/rendKeyboardMacro"
"/sexecuteKeyboardMacro"
"dumpMacro"}}
"(-"
"sendUrl"
{menu -m -n switchTo -p switchProc {}}
{menu -n internetConfig -p internetProc {
goTo
help
(-
webBrowser
newsClient
mailClient
(-
ftpClient
gopherClient
telnetClient
(-
resolveUrl
viewHtmlFile
}}
"(-"
"/M<I<OmatchingLines"
"gotoMatch"
"/inextMatch"
"(-"
"/jcmdDoubleClick"
}
proc compareProc {menu item} {
catch {compare$item} msg
message $msg
}
proc namedClipMenuProc {menu item} {
switch $item {
"copy" "copyNamedClipboard"
"cut" "cutNamedClipboard"
"paste" "pasteNamedClipboard"
}
}
menu -n Config {
{menu -n "Current Mode" -p modeMenuProc {
"menus╔"
"flags╔"
"editPrefs"
"loadPrefs╔"
"describeMode"
}}
{menu -n Global -p globalOptions {
"flags╔"
"editPrefs"
"/kdescribeBinding"
"listBindings"
"listFunctions"}}
"viewSavedSetting╔"
"removeSavedSetting╔"
"(-"
{menu -n appPaths {}}
{menu -m -n install -p installProc {
"Electric Alias"
"(-"
"LaTeX2e"
"LaTeX 2.09"
}}
"(-"
"/lsetFontsTabs╔"
{menu -n redefineColors -p colorProc {
foreground
background
"(-"
blue
cyan
green
magenta
red
white
yellow
"(-"
color_9
color_10
color_11
color_12
color_13
color_14
color_15}}
}
proc colorProc {menu item} {
global colorInds modifiedArrVars
if {[info exists colorInds($item)]} {
set color [eval [list colorTriple "New \"$item\":"] $colorInds($item)]
} else {
switch $item {
foreground { set inds "0 0 0" }
background { set inds "65535 65535 65535" }
blue { set inds "0 0 65535" }
cyan { set inds "61404 11464 34250" }
green { set inds "1151 33551 8297" }
magenta { set inds "44790 1591 51333" }
red { set inds "65535 0 0" }
white { set inds "65535 65535 65535" }
yellow { set inds "61834 64156 12512" }
default { set inds "65535 65535 65535" }
}
set color [eval [list colorTriple "New \"$item\":"] $inds]
}
eval setRGB $item $color
set colorInds($item) $color
lappend modifiedArrVars colorInds
}
# ==== NOTE: rectMarkHilite, onespace, centerRedraw, doTab
menu -n Text {
"/I<SfillParagraph"
"/I<S<O<IwrapParagraph"
"/I<S<O<UsentenceParagraph"
"/U<S<OfillRegion"
"/U<S<I<OwrapRegion"
"<E<SparagraphToLine"
"<SlineToParagraph"
"(-"
"<SreverseSort"
"<SsortLines"
"/L<I<OspellcheckWindow"
"(-"
"zapInvisibles"
"<SspacesToTabs"
"<StabsToSpaces"
"<S<EindentRegion"
"<SindentLine"
"<E<SdowncaseRegion"
"<SupcaseRegion"
"(-"
{menu -n Strings {
"<SremovePrefix"
"<SinsertPrefix"
"<S<EremoveSuffix"
"<SinsertSuffix"
"setPrefix"
"setSuffix"
}}
"/D<ScommentLine"
"/D<S<I<OuncommentLine"
"<SuncommentBox"
"<ScommentBox"
"<S<EuncommentParagraph"
"<ScommentParagraph"
"(-"
"/=markHilite"
{menu -n namedMarks -p namedMarkProc {
"/K<Oset╔"
"/K<I<Ogoto╔"
"remove╔"
"(-"
"sort"
"sortByPosition"}}
{menu -n unnamedMarks -p unnamedMarkproc {
"set╔"
"exchangePointAndMark"}}
}
proc strip {arg} {
if {[regsub -all {\\([][\{\}])} $arg {\1} v]} {return $v}
return $arg
}
#===============================================================================
proc helpMenu {item} {
global HOME
if {$item == "Alpha Manual"} {
edit -r "$HOME:Help:Manual"
} else {
edit -r "$HOME:Help:$item"
}
}
set men { "Alpha Manual" "Alpha Commands" "Tcl Commands" "(-" "Quick Start" "Readme" "Changes" "(-" }
foreach f [lsort -ignore [glob "$HOME:Help:*"]] {
set f [file tail $f]
if {($f != "Manual") && ($f != "Quick Start") && ($f != "Readme") && ($f != "Changes") && ($f != "ToDo") && ($f != "Alpha Commands") && ($f != "Tcl Commands")} {
lappend men $f
}
}
foreach f $men {
addHelpMenu $f
}
unset men
#===============================================================================
proc escapeSpaces {str} {
regsub -all { } $str {\ } str2
return $str2
}
proc buildSwitches {} {
global switchApps
menu -m -n switchTo -p switchProc {"<O<I/NNow╔" "Add╔" "Remove╔" "(-"}
if {[info exists switchApps] && [llength $switchApps]} {
foreach app $switchApps {
lappend names [file tail $app]
}
foreach name [lsort -ignore $names] {
addMenuItem -m -l "blah" switchTo $name
}
}
}
proc switchProc {menu name} {
global switchTo switchApps
if {$name == "Add"} {
set fname [getfile "Pick an app:"]
lappend switchApps $fname
addDef switchApps $switchApps
buildSwitches
} elseif {$name == "Remove"} {
foreach app $switchApps {
lappend apps [file tail $app]
}
set name [listpick -p "Remove which app?" $apps]
if {[set ind [lsearch $switchApps "*$name"]] >= 0} {
set switchApps [lreplace $switchApps $ind $ind]
addDef switchApps $switchApps
buildSwitches
}
} elseif {$name == "Now"} {
switchApp
} else {
if {[set ind [lsearch $switchApps "*$name"]] >= 0} {
if {[catch {switchTo $name}]} {
launch -f [lindex $switchApps $ind]
}
}
}
}
proc winTileProc {menu item} {
win$item
}
menu -n $winMenu -p menuWin {
"//<Szoom"
"//<S<I<OsinglePage"
"<S/;chooseAWindow"
"/I<Biconify"
{menu -n arrange -p winTileProc {
"/Jvertically^1"
"/J<O<Ihorizontally^2"
"tiled^3"
"overlay^4"
"(-"
{menu -n other {
{bufferOtherWindow}
{chooseAWindow}
{chooseWindowStatus}
{iconify}
{killWindowStatus}
{nextWin}
{nextWindow}
{otherThing}
{prevWindow}
{shrinkFull}
{shrinkHigh}
{shrinkLeft}
{shrinkLow}
{shrinkRight}
{singlePage}
{swapWithNext}
{threeQuarters}
{winhorizontally}
{winoverlay}
{wintiled}
{winvertically}
{zoom}
}}}}
"(-"
"/msplitWindow"
"/otoggleScrollbar"
"(-"
}
# We may be reloading, so add whatever windows we have
if {[info exists winNameToNum]} {
set nms [array names winNameToNum]
foreach name $nms {
regexp {[^:]*$} $name item
set num $winNameToNum($name)
if {$num < 10} {
addMenuItem -m $winMenu /$num$item
} else {
addMenuItem -m $winMenu $item
}
}
}
insertMenu "File"
insertMenu "Edit"
insertMenu "Text"
insertMenu "Search"
insertMenu "Utils"
#enableMenuItem NamedClipboards paste off
insertMenu "Config"
menu -n $fsetMenuName {};
insertMenu $winMenu
# catch {insertMenu $helpMenu}
# set modeMenus(global) "File Edit Text Search Utils Config $fsetMenuName $winMenu $mailMenu"
# set menuTrans($fsetMenuName) "File Sets"
# set menuTrans($winMenu) "Windows"
# set menuTrans($mailMenu) "Eudora"
menu -n $terrMenu {}
menu -n $toolserverMenu {}